
   <div class="row">
       <div class="col-xs-12">
           <div class="panel panel-default">
               <div class="panel-heading">
                   <h3 class="panel-title"><span class="glyphicon glyphicon-list-alt"></span>使用说明</h3>
               </div>
               <div class="panel-body">
                   <p style="text-indent: 2em;">此页面用于创建新的应用模块如：[admin--后台等]。
                   创建的模块将位于应用目录[protected]之下的[module]文件夹内，也可通过配置文件的['add_module']项
                   添加模块，配置后将在打开本页面后自动创建...</p>
               </div>
           </div>
       </div>
  </div>
  <div class="row">

       <div class="col-xs-8">

           <form action="_ACTION_" method="post" id="create_module_form" onsubmit="return form_check()"
                 class="form-horizontal">

               <fieldset>
                   <legend><span class="glyphicon glyphicon-pencil"></span>创建新的模块</legend>
                   <div style="display: none" id="notice_msg" class="alert alert-danger">
                       <!-- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> -->
                       模块名称不合法,仅允许创建2-10位以大小写字母、下划线为名称的模块
                   </div>
                   <div id="input_module" class="form-group">
                       <label for="create_module_name" class="col-lg-5 control-label">新创建模块名称</label>
                       <div class="col-lg-7">
                               <input type="text" class="form-control" placeholder="新的模块名称"
                               id="create_module_name" name="create_module"
                                      onblur="form_check()" onkeyup="form_check()" >
                               <span id="check_ok" class="glyphicon glyphicon-ok form-control-feedback"></span>
                               <span id="check_fail" class="glyphicon glyphicon-remove form-control-feedback"></span>
                           <!--<input class="form-control" name="create_module" id="create_module" placeholder="新的模块名称"  type="text"> -->
                       </div>
                   </div>
                   <div class="form-group">
                       <!--<div class="checkbox">-->
                       <label class="col-lg-5 control-label" >创建index.html </label>

                       <div class="btn-group col-lg-7" data-toggle="buttons">
                           <label class="btn btn-success active">
                               <input type="radio" name="create_index" value="1" id="option1" checked> 是
                           </label>
                           <label class="btn btn-success">
                               <input type="radio" name="create_index" value="0" id="option2"> 否
                           </label>
                       </div>
                       <small class="text-muted pull-right">选择是否创建一个空的index.html安全文件，默认创建</small>
                   </div>



                   <div class="form-group">
                       <label class="col-lg-5 control-label" for="option3">创建测试控制器</label>
                       <div class="btn-group col-lg-7" data-toggle="buttons">
                           <label class="btn btn-success active">
                               <input type="radio" name="create_test" value="1" id="option3" checked> 是
                           </label>
                           <label class="btn btn-success">
                               <input type="radio" name="create_test" value="0" id="option4"> 否
                           </label>
                       </div><br>
                       <small class="text-muted pull-right">选择是否创建一个用于测试的控制器类文件</small>
                   </div>


                   <div class="form-group">

                       <label class="col-lg-5 control-label" for="option5">跳转到测试页面</label>
                       <div class="btn-group col-lg-7" data-toggle="buttons">
                           <label class="btn btn-success active">
                               <input type="radio" name="jump_test" value="1" id="option5" checked> 是
                           </label>
                           <label class="btn btn-success">
                               <input type="radio" name="jump_test" value="0" id="option6"> 否
                           </label>
                       </div>
                       <small class="text-muted  pull-right">创建后跳转到模块的测试页面，必须选择'创建测试控制器'后，此项选择才是有效的</small>
                   </div>



                   <div class="form-group">
                       <div class="col-lg-8 col-lg-offset-4">
                           <button class="btn btn-primary btn-lg" type="submit">
                               <span class="glyphicon glyphicon-send"></span>&nbsp;&nbsp;
                               创 建 模 块
                           </button>
                       </div>
                   </div>
               </fieldset>

           </form>
           <!--######## js #########-->
           <script>
               function get(id){return document.getElementById(id);}
               function form_check()
               {
                   var notice_msg = get('notice_msg');
                   var c_module = get('create_module_name');
                   var input_module = get('input_module');
                   var check_ok = get('check_ok');
                   var check_fail = get('check_fail');
                   var c_module_v = c_module.value;
                   //alert(c_module_v);
                   var reg = /^[A-Za-z_]{2,10}$/g;
                   if (c_module_v ==''){
                       notice_msg.style.display= check_fail.style.display =check_ok.style.display='none';
                       input_module.className='form-group ';
                   } else {
                       if ( !reg.test( c_module_v ) ) //reg.test()用正则测试输入是否合法
                       {
                           //alert('模块名称不合法');
                           notice_msg.style.display= check_fail.style.display='block';
                           check_ok.style.display='none';
                           //c_module.style.borderColor = '#F60';
                           input_module.className='form-group has-error has-feedback';
                           return false;
                       }
                       notice_msg.style.display= check_fail.style.display='none';
                       input_module.className='form-group has-success has-feedback';
                       check_ok.style.display='block';
                       return true;
                   }
               }
           </script>
           <!--#################-->
           <hr/>
           <?php if (!empty($c_msg)):?>
           <div class="well">
                    <p><?php echo $c_msg;?></p>
           </div>
           <?php endif;?>
       </div>
       <div class="col-xs-3">
           <div class="panel panel-default">
               <div class="panel-heading">
                   <h3 class="panel-title"><span class="glyphicon glyphicon-list"></span>模块列表</h3>
               </div>
               <div class="panel-body">
                   <ul>
                       <?php //fecho($module)?>
                       <?php foreach( $module as $v) :
                            if (\ulue\web\Module::isFixed($v) ) { continue;}
                       ?>
                       <li class="module-list-item">
                           <a target="_blank" href="<?php echo $this->url($v);?>" class="module-list-item-a" title="访问<?php echo $v?>模块">
                           <?php echo $v?>
                           </a>
                           <a href="_CONTROLLER_/delete/name/<?php echo $v?>" title="删除模块"
                              class="pull-right" onclick="return confirm('确定删除！')">
                               <span class="glyphicon glyphicon-remove"></span>
                           </a>
                       </li>
                       <?php endforeach;?>
                   </ul>
               </div>
           </div>
       </div>

   </div>

